import 'package:flutter/material.dart';

class ButtonDemo extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(

      appBar: AppBar(title: Text('ButtonDemo'),),

      body: SizedBox(

        width: double.infinity,

        child: Flex(

          direction: Axis.vertical,

          children: <Widget>[

            //飘浮按钮，自带阴影和背景色，按下阴影变大
            RaisedButton(


              child: Text('RaisedButton'),
              onPressed: () {},
            ),

            //扁平按钮，没有阴影和背景色，按下回有背景色
            FlatButton(

              child: Text('FlatButton'),
              onPressed: () {},
            ),

            //默认有一个边框，没有阴影，背景透明，按下会出现背景
            OutlineButton(
              child: Text("OutlineButton"),
              onPressed: () {},
            ),


            //无背景，点击背景扩散，上面的按钮都可以通过 icon 构造函数创建
            IconButton(

              icon: Icon(Icons.settings),
              onPressed: () {},
            ),

            RaisedButton.icon(onPressed: () {},
                icon: Icon(Icons.print),
                label: Text('iocn构造函数')),


            //自定义样式
            RaisedButton(
              color: Colors.blue,
              colorBrightness: Brightness.dark,
              //按钮按下时的背景颜色
              splashColor: Colors.grey,
              //按钮主题，默认是浅色主题
              child: Text("Submit"),
              //点击时，水波动画中水波的颜色
              shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(20.0)),
              onPressed: () {},
              highlightColor: Colors.blue[700],
//                elevation = 2.0, //正常状态下的阴影
//                highlightElevation = 8.0,//按下时的阴影
//                disabledElevation = 0.0,// 禁用时的阴影
            )


          ],

        ),
      ),
    );
  }
}